<?php

namespace App\Http\Controllers\Agency;

use App\Http\Controllers\Controller;
use App\Services\ContractService;
use Illuminate\Http\Request;
use hg\apidoc\annotation as Apidoc;

/**
 * 线下vip管理
 * @Apidoc\Group("service")
 */
class ContractController extends Controller
{

    /**
     * @Apidoc\Title ("线下vip管理-发起合同")
     * @Apidoc\Url("/agency/createContract")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("id",type="int",require=true,desc="签约客户id")
     * @Apidoc\Param("realname",type="string",require=true,desc="客户姓名")
     * @Apidoc\Param("mobile",type="string",require=true,desc="客户电话")
     * @Apidoc\Param("idcard",type="string",require=true,desc="客户身份证")
     * @Apidoc\Param("package_name",type="int",require=false,desc="套餐名称")
     * @Apidoc\Param("price",type="float",require=true,desc="套餐价格")
     * @Apidoc\Param("days",type="int",require=true,desc="套餐周期")
     * @Apidoc\Param("nums",type="int",require=true,desc="约见人数")
     * @Apidoc\Param("signdate",type="int",require=true,desc="签约日期")
     * @Apidoc\Param("startdate",type="int",require=true,desc="服务开始日期")
     * @Apidoc\Param("remark",type="int",require=true,desc="备注")
     * @Apidoc\Param("belongid",type="int",require=true,desc="签约人id")
     * @Apidoc\Param("serviceid",type="int",require=true,desc="服务人id")
     * @Apidoc\Param("inviteid",type="int",require=true,desc="邀约人id")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     **/

    public function createContract(Request $request , ContractService $contractService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $contractService->createContract($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }
}
